﻿//页面过期作废 2009-6-4 李刚
using System;
using System.Collections;
using System.Configuration;
using System.Data;

using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using System.Collections.Generic;
using HZ.DrugTrade.IBLL;
using HZ.DrugTrade.BLLFactory;
using HZ.DrugTrade.Model;
using HZ.DrugTrade.Model.Enum;

namespace HZ.DrugTrade.Web.Admin.BidProdManage
{
    public partial class PriceAdjustPlanAddList : BasePage
    {
        public PriceAdjustPlanAddList()
        {
            this.ModuleNo = Module.调价计划列表.ToString();
            this.PageOperateType = OperateType.调价计划列表.ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                setBind();
            }
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            AspNetPager1.CurrentPageIndex = 1;
            setBind();
        }

        private void setBind()
        {
            //获取查询条件
            Model.Query.ProcureCatalog procureCatalog = new HZ.DrugTrade.Model.Query.ProcureCatalog();
            procureCatalog.CompanyName_SC = txtProduceCompany_SC.Text.Trim();
            procureCatalog.GoodsName = txtGoodsName.Text.Trim();
            procureCatalog.Material = txtMaterial.Text.Trim();
            procureCatalog.Outlookc = txtOutLook.Text.Trim();
            procureCatalog.ProjectName = txtProject.Text.Trim();
            procureCatalog.CompanyName_TB = txtCompany_TB.Text.Trim();
            procureCatalog.Unit = txtUnit.Text.Trim();
            procureCatalog.SortFields = "AddTime DESC";

            if (!string.IsNullOrEmpty(txtProcureStartTime.Text.Trim()))
            {
                procureCatalog.ProcureStartTime = Convert.ToDateTime(txtProcureStartTime.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtProcureEndTime.Text.Trim()))
            {
                procureCatalog.ProcureEndTime = Convert.ToDateTime(txtProcureEndTime.Text.Trim());
            }

            //调用方法，执行查询，分页显示产品信息
            //AspNetPager1.PageSize = Constants.GRIDVIEW_PAGE_SIZE;
            int totalCount = 0;
            IBLL_ProcurementBasic ipb = Factory.BLL_ProcurementBasic();
            try
            {

                IList<Model.View.ProcureCatalog> procureCatalogList = ipb.GetProcureCatalogByWhere(procureCatalog, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount);
                AspNetPager1.RecordCount = totalCount;
                gvwProduceCatalog.DataSource = procureCatalogList;
                gvwProduceCatalog.DataBind();
            }
            catch (Exception ex)
            {
                PageError(ex.Message, "");
            }
        }

        protected void AspNetPager1_OnPageChanged(object sender, EventArgs e)
        {
            setBind();
        }
    }
}

